#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
int n,k,d;
int a[N],t[N],f[N];
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
    return x*f;
}
signed main(){
    freopen("holiday.in","r",stdin);
    freopen("holiday.out","w",stdout);
    n=read();k=read();d=read();
    for(int i=1;i<=n;i++) a[i]=read();
    for(int i=1;i<n;i++) t[i]=read();
    for(int i=1;i<=n;i++) f[i]=-1e18;
    f[1]=a[1];
    for(int i=1;i<n;i++){
        for(int j=i+1;j<=i+t[i];j++) f[j]=max(f[j],f[i]+a[j]-(j-i)/k*d);
    }
    printf("%lld",f[n]);
    return 0;
}